//
//  TCLYNewsTableViewCell.m
//  YuErmuYing
//
//  Created by LYang on 16/8/22.
//  Copyright © 2016年 Tiancheng. All rights reserved.
//

#import "TCLYNewsTableViewCell.h"
#import "Macros.h"
#import "Masonry.h"

@implementation TCLYNewsTableViewCell
-(instancetype)initWithReuseIdentifier:(NSString *)reuseIdentifier{
    if (self = [super initWithStyle:UITableViewCellStyleDefault reuseIdentifier:reuseIdentifier]) {
        UIImageView * bgImageView = [[UIImageView alloc] init];
        bgImageView.backgroundColor = bgColor;
        [self addSubview:bgImageView];
        [bgImageView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.mas_equalTo(self);
            make.left.mas_equalTo(self);
            make.bottom.mas_equalTo(self);
            make.right.mas_equalTo(self);
        }];
        
        UIView * bgView = [[UIView alloc] init];
        bgView.backgroundColor = [UIColor whiteColor];
        [self addSubview:bgView];
        [bgView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.mas_equalTo(self.mas_top).offset(12);
            make.left.mas_equalTo(self);
            make.right.mas_equalTo(self);
            make.bottom.mas_equalTo(self);
        }];
        
        self.dayLabel = [[UILabel alloc] init];
        self.dayLabel.textAlignment = NSTextAlignmentLeft;
        self.dayLabel.textColor = blackFont;
        self.dayLabel.font = [UIFont systemFontOfSize:12];
        self.dayLabel.numberOfLines = 1;
        [bgView addSubview:self.dayLabel];
        [self.dayLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.mas_equalTo(self.mas_left).offset(12);
            make.right.mas_equalTo(self.mas_right).offset(-12);
            make.top.mas_equalTo(bgView.mas_top).offset(10);
            make.height.mas_equalTo(30);
        }];
        UIImageView * lineImageView = [[UIImageView alloc] init];
        lineImageView.backgroundColor = [UIColor lightGrayColor];
        [self addSubview:lineImageView];
        [lineImageView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.mas_equalTo(self.dayLabel.mas_bottom).offset(0);
            make.left.mas_equalTo(self);
            make.right.mas_equalTo(self);
            make.height.mas_equalTo(1);
        }];
        self.contentLabel = [[UILabel alloc] init];
        self.contentLabel.textAlignment = NSTextAlignmentLeft;
        self.contentLabel.textColor = blackFont;
        self.contentLabel.font = [UIFont systemFontOfSize:12];
        self.contentLabel.numberOfLines = 1;
        [self addSubview:self.contentLabel];
        [self.contentLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.mas_equalTo(lineImageView.mas_bottom).offset(0);
            make.left.mas_equalTo(self.dayLabel);
            make.right.mas_equalTo(self.dayLabel);
            make.height.mas_equalTo(30);
        }];
        self.headerImageView = [[UIImageView alloc] init];
        self.headerImageView.layer.cornerRadius = 15;
        self.headerImageView.layer.masksToBounds = YES;
        [self addSubview:self.headerImageView];
        [self.headerImageView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.mas_equalTo(self.mas_top).offset(0);
            make.left.mas_equalTo(self.mas_left).offset(0);
            make.width.mas_equalTo(30);
            make.height.mas_equalTo(30);
        }];
    }
    return self;
}
- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
